﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NibbleOil.Web.Business.Model;

namespace NibbleOil.Web.Business
{
    public sealed class DataContext 
    {
        private static volatile DataContext instance;
        private static readonly object padlock = new object();
        private static NibbleOilWebEntities model;

        private DataContext()
        {
            model = new NibbleOilWebEntities();
        }

        public static DataContext Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (padlock)
                    if (instance == null)
                        instance = new DataContext();
                }

                return instance;
            }
        }

        public NibbleOilWebEntities Model
        { 
            get 
            { 
                return model; 
            } 
        }
    }
}
